package com.demo;

import java.lang.reflect.Method;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

/****
 * 实现MethodInterceptor的intercept，实现被代理对象的逻辑植入。也是最常用的callback
 */
public class MethodInterceptorCallback implements MethodInterceptor {
    @Override
	public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
        System.out.println("before invoke........");
        // 可以避免反射
        proxy.invokeSuper(obj,args);
        System.out.println("after invoke.........");
        return null;
    }
}
